package com.imooc.security.log;

import java.util.Date;

import javax.persistence.*;

import org.springframework.data.annotation.CreatedBy;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedDate;

import lombok.Data;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

/**
 * @author wangyouliang
 * 解释：
 * "@EntityListeners()"该注解用于指定Entity或者superclass上的回调监听类。该注解可以用于Entity或者superclass上。
 * "AuditingEntityListener.class"这是一个JPA Entity Listener，用于捕获监听信息，当Entity发生持久化和更新操作时。
 */
@Entity
@Data
@EntityListeners(AuditingEntityListener.class)
public class AuditLog {
	
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	private Long id;
	
	@Temporal(TemporalType.TIMESTAMP)
	@CreatedDate
	private Date createdTime;
	
	@Temporal(TemporalType.TIMESTAMP)
	@LastModifiedDate
	private Date modifyTime;
	
	private String method;
	
	private String path;

	private Integer status;

	@CreatedBy
	private String username;

}
